<?php

namespace App\Kuafu\Mybank\Service;

use App\Kuafu\Base\Service\BaseService;
use App\Kuafu\Mybank\Model\MybankOrderWithholdRecordModel;

class MybankOrderWithholdRecordService extends BaseService
{

    /***
     * 获取夸父支付信息
     * @param array $ids
     * @return array
     */
    public static function getKfPayInfoByIds(array $ids): array
    {
        if (empty($ids)) {
            return [];
        }
        $list = MybankOrderWithholdRecordModel::query()
                                              ->with("myPayStreamRel")
                                              ->whereIn('id', $ids)
                                              ->get();

        $newArrays = [];
        if (!empty($list)) {
            foreach ($list as $item) {
                $payNo  = 0;
                $shopId = 0;
                $bizId  = 0;
                if (!empty($item['myPayStreamRel'])) {
                    $payNo  = $item['myPayStreamRel']['payNo'];
                    $shopId = $item['myPayStreamRel']['shopId'];
                    $bizId  = $item['myPayStreamRel']['bizId'];

                }
                $newArrays[$item['id']] = [
                    // 支付单号
                    'payNo'      => $payNo,
                    // 渠道号
                    'outTradeNo' => $item['outTradeNo'],
                    // 门店编号
                    'shopId'     => $shopId,
                    // 三方业务单号
                    'bizId'      => $bizId,
                    // other ,需要啥自己加
                ];
            }
        }
        return $newArrays;
    }


}